package base.day22.stream;

import java.util.ArrayList;
import java.util.function.Predicate;

public class MyStream3 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("abc");
        list.add("ccc");
        list.add("acd");
        list.add("ccc");

        list.stream().filter(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                boolean result = s.startsWith("a");
                return result;
            }
        }).forEach(s-> System.out.println(s));
        System.out.println("--------------------------");

        list.stream().filter(
                (String s)->{
                    boolean result=s.startsWith("a");
                    return result;
                }
        ).forEach(s-> System.out.println(s));
        System.out.println("-----------------------------");

        list.stream().filter(s->s.startsWith("a")).forEach(s-> System.out.println(s));

    }
}
